package zero.tech.games.pdk.event;

import zero.tech.core.event.EventListener;
import zero.tech.core.event.EventType;
import zero.tech.games.logic.common.Room;
import zero.tech.games.logic.data.LogicEventType;
import zero.tech.games.logic.data.RoomStatus;
import zero.tech.games.pdk.data.PdkTimer;

public class RoomDissolutionRuntimer implements EventListener{

	@Override
	public EventType netEventType() {
		return LogicEventType.ROOM_DISSOLUTION_RUNTIMER;
	}

	@Override
	public void notifyEvent(Object... objs) {
		Room room = (Room) objs[0];
		long pass=(long) objs[1];
		int room_status=room.getRoom_status();
		PdkTimer pdkTimer = (PdkTimer) room.getTimer();
		if(room_status==RoomStatus.GAMING) {
			pdkTimer.lastDispatchTime+=pass;
		}else if(room_status==RoomStatus.WAIT_NEXT_ROUND) {
			pdkTimer.lastBeginToReadyTime+=pass;
		}
	}

	@Override
	public boolean asynchronous() {
		return false;
	}

}
